Bike Trips Sample Application: Using the XMLConnector Component in Flash MX Professional 2004
Table of Contents
- Introduction
- Getting Started: Examining the Bike Trips Application and Its Data
- Configuring the Application to Use the XMLConnector Component
- Binding XML Data to a ComboBox Component
- Creating ComboBox Labels Using XML Data
- Displaying and Updating a Trip Description in a TextArea Component
- Displaying and Updating a Formatted Cost in a TextInput Component
- Displaying and Updating a Graphic in a Loader Component
- Summary and Related Articles and Resources
Creating ComboBox Labels Using XML Data
Format the inbound data from the xcTrips XMLConnector so the cbTrips ComboBox knows to display the name property from each object in the inbound array as the label property for each of its own rows:
- Select cbTrips.
- Open the Bindings tab of the Component Inspector panel.
- Select the dataProvider binding.
- Set the binding's direction to in, as it is inbound from xcTrips:results:trips:trip.
- Set the formatter property for this binding to Rearrange Fields.
- Select the formatter options property and press the magnifying glass button to open the Rearrange Fields dialog box.
-
Set the Fields definitions to label=name and click OK.
You've exposed complex data—an array of objects, in which each object has five properties (a data structure you could analogize to a table where each row has five columns)—from the xcTrips XMLConnector component. But, because a ComboBox can only expose one value as a label for each row, you must specify what specific outbound property to use as the value for each label. Although we do not do so here, it's also possible to concatenate multiple values as a single String in the label.
-
Select Control > Test Movie to test your application. The name value from each Object in the trip:Array outbound from xcTrips should now appear as the label for each row of the cbTrips ComboBox.
Figure 3. View of ComboBox showing labels from xcTrips
- Save your changes to XMLConnector_step2.fla.